<?php
//$array = ['后盾人','HDCMS','向军大叔'];
//echo key($array);
//echo current($array);
//将数组指针向下移动一位
//echo next($array);
//echo next($array);
//将数组的指针向上移动一位
//echo prev($array);


#指针遍历
$users = [
    ['name'=>'向军大叔','age'=>16],
    ['name'=>'小明','age' => 22],
    ['name' => '李四','age' => 34],
    ['name' => '张三','age' => 19]
];
?>

<!--<table border="1">-->
<!--    <tr><th>编号</th><th>姓名</th><th>年龄</th></tr>-->
<!--    --><?php //while($user = current($users)): ?>
<!--    <tr>-->
<!--        <td>--><?php //echo key($users)+1; ?><!--</td>-->
<!--        <td>--><?php //echo $user['name']; ?><!--</td>-->
<!--        <td>--><?php //echo $user['age']; ?><!--</td>-->
<!--    </tr>-->
<!--    --><?php //next($users); endwhile; ?>
<!--</table>-->

<?php
//    foreach($users as $key => &$user){
//        //给每个人的年龄增加五岁
//        $user['age'] += 5;
//        echo "[{$key}] 姓名:{$user['name']} 年龄:{$user['age']}"."<hr>";
//    }


while(list('name'=>$name,'age'=>$age) = current($users)){
    echo "name:{$name}<hr/>";
    next($users);
}

?>


<?php
//$arr = ['向军','hdcms'];
//list($name,$soft) = $arr;
//echo $soft,$name;

//$arr = ['向军','hdcms','houdunren.com'];
//list(,,$web) = $arr;
//echo $web;
?>
